<template>
	<view class="demo">
		<!-- 	<view class="topse">
			<view class="tops_left">
				<h3 style="margin-left: 3vw;font-size: 4vw;margin-top: 5vw;">手机账号</h3>
				<p style="margin-left: 3vw;font-size: 3vw;color: #ccc;">管理APP使用的系统权限</p>
			</view>
			<view class="tops_right">

				<p style="font-size: 7vw;color: #ccc;line-height: 13vw;"><span
						style="font-size: 4vw;color: #ccc;"></span> > </p>

			</view>
		</view> -->
		<view class="topse" @click="real">
			<view class="tops_left" style="width: 83%;">
				<h3 style="margin-left: 3vw;font-size: 4vw;margin-top: 5vw;">实名认证</h3>
				<!-- <p style="margin-left: 3vw;font-size: 3vw;color: #ccc;">管理APP使用的系统权限</p> -->
			</view>
			<view class="tops_right" style="width: 17%;">

				<p v-if="names==''" style="font-size: 7vw;color: #ccc;line-height: 13vw;"><span
						style="font-size: 4vw;color: #ccc;"></span> > </p>
				<p v-else style="font-size: 7vw;color: #ccc;line-height: 13vw;"><span
						style="font-size: 4vw;color: #ccc;">{{names}}</span> </p>
			</view>
		</view>
		<view class="topse" @click="logout">
			<view class="tops_left">
				<h3 style="margin-left: 3vw;font-size: 4vw;margin-top: 5vw;">注销账号</h3>
				<!-- <p style="margin-left: 3vw;font-size: 3vw;color: #ccc;">管理APP使用的系统权限</p> -->
			</view>
			<view class="tops_right">

				<p style="font-size: 7vw;color: #ccc;line-height: 13vw;"><span
						style="font-size: 4vw;color: #ccc;"></span> > </p>

			</view>
		</view>
		<u-modal :show="logOutShow" title="确认注销" :showCancelButton="true" @cancel="logOutShow=false" @confirm='confirm'>
			<view class="slot-content">
				<rich-text @close="logOutClose"></rich-text>
			</view>
		</u-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				names: "",
				logOutShow: false
			}
		},
		onShow() {
			this.int()
		},
		methods: {
			int() {
				this.names = uni.getStorageSync("datausers").real_name
			},
			real() {
				if (this.names == "") {
					uni.navigateTo({
						url: "/pages/real/real"
					})
				} else {
					uni.showToast({
						title: '您已成功实名',
						icon: 'success', //将值设置为 success 或者 ''
						duration: 2000 //持续时间为 2秒
					})
				}
			},
			logout() {
				this.logOutShow = true
			},
			logOutClose() {
				this.logOutShow = false
			},
			confirm() {
				uni.showLoading({
					title: "注销中"
				})
				uni.request({
					url: "/api/user/cancalAccount",
					method: "POST",
					header: {
						token: uni.getStorageSync('token')
					}
				}).then(res => {
					if (res.data.code == 1) {
						uni.hideLoading()
						uni.navigateTo({
							url: "/pages/login/login"
						})
					}

				})
			}
		}
	}
</script>

<style>
	.demo {
		width: 100vw;
		height: 100vh;
		background-color: #f6f9fc;
		display: flex;
		flex-direction: column;
		align-items: center;
		overflow: scroll;

	}

	.topse {
		width: 100%;
		height: 15vw;

		background-color: #ffffff;
		border-radius: 2vw;
		display: flex;
	}

	.tops_left {
		width: 90%;
		height: 100%;
	}

	.tops_right {
		width: 10%;
		height: 100%;
	}
</style>